package com.yangmao.yangrpc.registry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 本地注册中心
 */
public class LocalRegistry {

    /**
     * 注册信息存储
     */
    private static final Map<String,Class<?>> map = new ConcurrentHashMap();

    /**
     * 注册服务
     * @param serviceName
     * @param imClass
     */
    public static void registries(String serviceName,Class<?> imClass){
        map.put(serviceName,imClass);
    }

    /**
     * 获取服务
     * @param serviceName
     * @return
     */
    public static Class<?> getService(String serviceName){
        return map.get(serviceName);
    }

    /**
     * 删除服务
     * @param serviceName
     */
    public static void removeService(String serviceName){
        map.remove(serviceName);
    }
}
